package com.mallcloud.mall.mall.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mallcloud.mall.mall.api.entity.MallImageGroupModel;
import com.mallcloud.mall.mall.mapper.MallImageGroupMapper;
import com.mallcloud.mall.mall.service.MallImageGroupService;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

/**
 * 图片组表
 */
@Service
public class MallImageGroupServiceImpl extends ServiceImpl<MallImageGroupMapper, MallImageGroupModel> implements MallImageGroupService {

	@Override
	public List<Long> getGroupIds() {
		return this.list(Wrappers.<MallImageGroupModel>lambdaQuery()
				.select(MallImageGroupModel::getGroupId)
				.orderByAsc(MallImageGroupModel::getGroupId)
		)
				.stream()
				.map(MallImageGroupModel::getGroupId)
				.distinct()
				.collect(Collectors.toList());
	}
}
